package com.maven.booksystem.mapper;


import com.maven.booksystem.model.BookInfo;
import com.maven.booksystem.model.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface BookMapper {

    @Select("select * from book_info where `status` <> 0")
    public List<BookInfo> getBookInfo();


    public Integer  insertBook(BookInfo bookInfo);



    @Select("select * from book_info where `status` <> 0 order by id asc limit #{offset},#{pageSize}")
    List<BookInfo> queryListByPage(PageInfo pageInfo);


    @Select("select count(1) from book_info where `status` <> 0")
    Integer count();


    @Select("select * from book_info where `status` <> 0 and id = #{id}")
    public BookInfo getBookInfoById(Integer id);

    Integer updateBook(BookInfo bookInfo);

    Integer batchDelete(List<Integer> ids);
}
